﻿@using RoadFlow.Utility;
@model RoadFlow.Model.Message
<table cellpadding="0" cellspacing="1" border="0" width="99%" class="formtable" style="margin-top:10px;">
    <tr>
        <th style="width: 80px;">接收人员：</th>
        <td>@(new RoadFlow.Business.Organize().GetNames(Model.ReceiverIdString))</td>
    </tr>
    <tr>
        <th style="width: 80px;">接收方式：</th>
        <td>@(new RoadFlow.Business.Message().GetSendTypeString(Model.SendType))</td>
    </tr>
    <tr>
        <th style="width: 80px;">消息内容：</th>
        <td>@Html.Raw(Model.Contents)</td>
    </tr>
    <tr>
        <th style="width: 80px;">附件：</th>
        <td>@Html.Raw(Model.Files.ToFilesShowString(false))</td>
    </tr>
    @if ("1".Equals(ViewData["showreadlist"].ToString()))
    {
    <tr>
        <th style="width: 80px;">阅读情况：</th>
        <td>
            <table id="listtable"></table>
            <div class="buttondiv"></div>
        </td>
    </tr>
    }
</table>
<script type="text/javascript">
    var showReadList = "1" == "@ViewData["showreadlist"]";
    var curPageSize;
    var curPageNumber;
    $(function () {
        if (showReadList) {
            $("#listtable").jqGrid({
                url: "QuerySendRead@(Html.Raw(ViewData["queryString"]))",
                postData: {},
                mtype: 'POST',
                datatype: "json",
                colNames: ['接收人', '所在组织', '是否阅读', '阅读时间'],
                colModel: [
                    { name: 'UserId', index: 'UserId', width: 50 },
                    { name: 'Organize', index: '', width: 250 },
                    { name: 'IsRead', index: 'IsRead', width: 30 },
                    { name: 'ReadTime', index: 'ReadTime', width: 90 },
                ],
                sortname: "UserId",
                sortorder: "asc",
                height: '100%',
                width: $(window).width() - 95,
                multiselect: false,
                onSelectRow: function () {

                },
                loadComplete: function () {
                    var gridObj = $("#listtable");
                    var records = gridObj.getGridParam("userData");
                    curPageSize = records.pagesize;
                    curPageNumber = records.pagenumber;
                    $(".buttondiv").html(RoadUI.Core.getPager1(records.total, records.pagesize, records.pagenumber, "query"));
                }
            });
        }
    });
    $(window).resize(function () {
        $("#listtable").setGridWidth($(window).width());
    });
    function query(size, number) {
        var data = {
            pagesize: size || curPageSize, pagenumber: number || curPageNumber
        };
        $("#listtable").setGridParam({ postData: data }).trigger("reloadGrid");
    }
</script>

